package com.itheima.reggie.common;

/**
 * 维护本地线程的工具类
 */
public class BaseContext {

    private BaseContext(){

    }

    //定义一个本地线程对象
    private static final ThreadLocal<Long> THREAD_LOCAL=new ThreadLocal<>();

    //提供静态方法,设置数据
    public static void setCurrentId(Long employee){
        THREAD_LOCAL.set(employee);

    }

    //提供静态方法,获取数据
    public static Long getCurrentId(){
        return THREAD_LOCAL.get();
    }

    //提供静态方法.移除数据
    public static void removeCurrentId(){
        THREAD_LOCAL.remove();
    }

}
